package com.mymall.serve.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;

@Slf4j
@Service
public class TestServiceRest {

    @Autowired
    private RestTemplate restTemplate;

    @PostConstruct
    void testInit(){
        log.info(">>>https请求测试");
        try {
            String forObject = restTemplate.getForObject("https://www.baidu.com", String.class);
            log.info(forObject.substring(0,15));
        }catch (Exception e){
            log.error("测试异常",e);
        }
    }


}
